﻿

// JavaScript Documentfunction gettheDate() {

var timerID = null;
var timerRunning = false;
function showtime() {

    var currentTime = new Date()
    var month = currentTime.getMonth() + 1
    var day = currentTime.getDate()
    var year = currentTime.getFullYear()
    ///
    var now = new Date();
    var hours = currentTime.getHours();
    var minutes = currentTime.getMinutes();
    var seconds = currentTime.getSeconds();
    //Get full date time
    var timeValue = getVietNamesDayName(currentTime.getDay()) + " , Ngày " + day + "/" + month + "/" + year + " - " + (hours);

    //Get date time

    timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
    timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
    //	timeValue += (hours >= 12) ? " CH " : " SA ";
    timeValue += " | GMT + 7";

    var datetimeid = document.getElementById("divDateTime");
    datetimeid.innerHTML = timeValue;
}
function showtimeEngLish() {

    var currentTime = new Date()
    var month = currentTime.getMonth() + 1
    var day = currentTime.getDate()
    var year = currentTime.getFullYear()
    ///

    var hours = currentTime.getHours();
    var minutes = currentTime.getMinutes();
    var seconds = currentTime.getSeconds();
    var timeValue = currentTime.toLocaleDateString() + " - " + ((hours > 12) ? hours - 12 : hours);
    timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
    timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
    timeValue += (hours >= 12) ? " P.M " : " A.M ";
    timeValue += " | GMT + 7";

    var datetimeid = document.getElementById("divDateTime");
    datetimeid.innerHTML = timeValue;
}
function getVietNamesDayName(num) {
    var day = new Array("Chủ nhật", "Thứ 2", "Thứ 3", "Thứ 4", "Thứ 5", "Thứ 6", "Thứ 7");

    return day[num];
}
function getEngLishDayName(num) {
    var day = new new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
    return day[num];
}

function GetDate() {
    setInterval("TimeUpdate()", 1000);
}
function TimeUpdate() {

    showtime();
}

